<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<link type="text/css" rel="stylesheet" xml:lang="en" href="style.css" />

<?php 
set_time_limit(0);
$root=preg_replace('/cron$/', '', dirname(__FILE__));

require_once($root."inc.config.php");

require_once($root."initialize.php");

if(($db_msg=cron_initialize()) !== true){

	print_r("Connection error");

}else{ 
	$count=0;
	$r=mysql_query("select name,address,city,zip,state,country,sum(swallet) as swallet from gg_users where swallet>0 group by name order by sum(swallet) desc");
	while($user = mysql_fetch_assoc($r))
	{
		$count++;
if($count==23 || $count==2 || $count==3 || $count==175 || $count==25 || $count==31 || $count==36 || $count==39 || $count==41 || $count==28 || $count==41 || $count==42 || $count==43 || $count==44 || $count==45 || $count==46 || $count==47 || $count==48 || $count==49 || $count==50 || $count==52 || $count==190 || $count==191){
?>

<table border="0" cellspacing="37" cellpadding="0" style="width: 8in; height: 11in">

	<tr>

		<td>

		

<!-- certificate container -->

<table border="0" cellpadding="0" cellspacing="17" width="100%">

  <tbody>

    <tr>

		<td align="center" valign="top" width="30%">

		

<p><big><big><strong>The Fragrant Prosperity PLC</strong></big></big></p>



		</td>

		<td width="35%">&nbsp;</td>

		<td width="35%" valign="top" colspan="2" rowspan="1">&nbsp;</td>

    </tr>

    <tr>

		<td colspan="1" rowspan="2">

		

		<p><strong><?php echo $user['name']; ?><br />

		<?php echo $user['address']; ?><br />

		<?php echo $user['city']; ?><br />

		<?php echo $user['zip']; ?><br />

		<?php echo $user['state']; ?><br />

		<?php echo $user['country']; ?></strong></p>


		</td>

		<td colspan="1" rowspan="2">&nbsp;</td>

		<td colspan="2" rowspan="1"><img src="RG_Logo.png" width="230" height="173" alt="RG" /></td>

    </tr>

    <tr>

		<td valign="bottom">



<p><strong><small>Shareholder reference number</small></strong><br>

<br />

<strong>M<?php echo str_pad($count, 8, "0", STR_PAD_LEFT); ?></strong></p>



		</td>

		<td align="right" valign="bottom"><p><strong>RGL</strong></p></td>

    </tr>

    <tr>

		<td style="border-width: 1px 0px 1px 0px; border-style: solid; border-color: #000000;" valign="top" colspan="4" rowspan="1"><span class="paratext"><strong><big>CASH FLOW CERTIFICATE</big></strong></span></td>

    </tr>

    <tr>

		<td align="center" valign="top" colspan="4" rowspan="1"><h1>Yun Hai INTERNATIONAL</h1></td>

    </tr>

    <tr>

		<td valign="bottom"><span class="paratext">Number of Units</span></td>

		<td valign="bottom" align="center"><span class="paratext"><strong><big>**<?php echo $user['swallet']; ?>**</big></strong></span></td>

		<td valign="bottom" align="right" colspan="2" rowspan="1"><span class="paratext">Issued Date (30/04/2011)</span></td>

    </tr>

    <tr>

		<td colspan="4" rowspan="1">



<p><strong>This is to certify that</strong><br>

<br>

<?php echo $user['name']; ?>

<br>

<br>

is/are the Registered Holder(s) of <?php echo convert_number($user['swallet']); ?> units, fully paid, in Yun Hai International.</p>

<br>

<p>For and on behalf of Yun Hai International</p>

		</td>

    </tr>

    <tr>

		<td colspan="4" rowspan="1">

<br>

<br>

<br>

<br />

<br />

<img src="signature.png" width="256" height="153" alt="Signature" />

<p><strong>Authorised Signatory</strong></p></td>

    </tr>

    <tr>

		<td colspan="2" rowspan="1">&nbsp;</td>

		<td align="right" rowspan="1" colspan="2"><p><small>Certificate No M<?php echo str_pad($count, 8, "0", STR_PAD_LEFT); ?></small></p></td>

    </tr>

  </tbody>

</table>

<!-- end certificate container -->

		

		</td>

	</tr>

</table>

<?php }}}

function convert_number($number) 
{ 
    if (($number < 0) || ($number > 999999999)) 
    { 
    throw new Exception("Number is out of range");
    } 

    $Gn = floor($number / 1000000);  /* Millions (giga) */ 
    $number -= $Gn * 1000000; 
    $kn = floor($number / 1000);     /* Thousands (kilo) */ 
    $number -= $kn * 1000; 
    $Hn = floor($number / 100);      /* Hundreds (hecto) */ 
    $number -= $Hn * 100; 
    $Dn = floor($number / 10);       /* Tens (deca) */ 
    $n = $number % 10;               /* Ones */ 

    $res = ""; 

    if ($Gn) 
    { 
        $res .= convert_number($Gn) . " Million"; 
    } 

    if ($kn) 
    { 
        $res .= (empty($res) ? "" : " ") . 
            convert_number($kn) . " Thousand"; 
    } 

    if ($Hn) 
    { 
        $res .= (empty($res) ? "" : " ") . 
            convert_number($Hn) . " Hundred"; 
    } 

    $ones = array("", "One", "Two", "Three", "Four", "Five", "Six", 
        "Seven", "Eight", "Nine", "Ten", "Eleven", "Twelve", "Thirteen", 
        "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eightteen", 
        "Nineteen"); 
    $tens = array("", "", "Twenty", "Thirty", "Fourty", "Fifty", "Sixty", 
        "Seventy", "Eigthy", "Ninety"); 

    if ($Dn || $n) 
    { 
        if (!empty($res)) 
        { 
            $res .= " and "; 
        } 

        if ($Dn < 2) 
        { 
            $res .= $ones[$Dn * 10 + $n]; 
        } 
        else 
        { 
            $res .= $tens[$Dn]; 

            if ($n) 
            { 
                $res .= "-" . $ones[$n]; 
            } 
        } 
    } 

    if (empty($res)) 
    { 
        $res = "zero"; 
    } 

    return $res; 
} 
?>
